home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / C-D / ChangeObjectLayer.cpt / ChangeObjectLayer / background_2599.txt < prev    next >
Text File  |  1989-04-13  |  10KB  |  413 lines

  1. -- background: 2599 from stack: in
  2. -- bmap block id: 3218
  3. -- flags: 0000
  4. -- background id: 0
  5. -- name: 
  6. ----- HyperTalk script -----
  7. --ChangeObjectLayer 1.0
  8. --¬©1988 by Dean H Wette
  9. --921 DeMun Avenue 2N
  10. --Clayton, MO  63105
  11. --314-863-4944
  12. --CompuServe 72317,2034
  13. --Please include the above credits with the script.
  14. --This stack is TradeWare. See the "About..." window
  15. --for more information and instructions.
  16.  
  17. ------------------------------------------------------------------------
  18.  
  19. --The best place for these scripts is in the Home stack, thus
  20. --making "ChangeObjectLayer" available to all your stacks.
  21.  
  22. --Begin ChangeObjectLayer 1.0
  23.  
  24. --This is the handler called by the target object.
  25. --The call, "setLayer", should be the second line
  26. --of the object's script, after "on mouseUp".
  27.  
  28. on setLayer
  29.   global objectNumber,objectType,optionState
  30.   put the optionKey into optionState
  31.  
  32.   --We need information about the target object ‚Äî get it from
  33.   --the "objectInfo" function.
  34.   put objectInfo() into doMenuWhich
  35.  
  36.   lock screen
  37.   set lockMessages to true
  38.  
  39.   --Go from the browse tool to the object's editing tool
  40.   --and select the object.
  41.   if objectType = "button" then choose btn tool else choose fld tool
  42.   select the target
  43.  
  44.   --This is where the work gets done.
  45.  
  46.   repeat until the number of the target = objectNumber
  47.     set cursor to busy
  48.  
  49.     --Find out if the object goes to a higher or lower layer, or
  50.     --if it's all just a waste of time.
  51.     if doMenuWhich < 0 then doMenu "Send Farther"
  52.     if doMenuWhich > 0 then doMenu "Bring Closer"
  53.     if doMenuWhich = 0 then exit repeat
  54.   end repeat
  55.   beep
  56.  
  57.   --We're finished so let's clean up & return everything to normal.
  58.   set cursor to 4
  59.   choose browse tool
  60.   unlock screen
  61.   set lockMessages to false
  62.   put empty into objectNumber
  63.   put empty into objectType
  64.   put empty into optionState
  65.  
  66.   --Let's remove the "setLayer" call for the user, that is,
  67.   --if it's in the right place!
  68.   if line 2 of script of target contains "setLayer" then
  69.     put script of target into objectScript
  70.     put empty into line 2 of objectScript
  71.     set script of target to objectScript
  72.   else
  73.   end if
  74.  
  75.   --We just want to change the object's layer so let's not
  76.   --execute its normal script
  77.   exit to HyperCard
  78.  
  79. end setLayer
  80.  
  81. --This is the function that returns all the object information
  82. --needed to allow "setLayer" to perform properly.
  83.  
  84. function objectInfo
  85. global objectNumber,objectType,optionState
  86.  
  87. --Is the Object a field or a button?
  88. if the name of the target contains "field" then
  89.   put "field" into objectType
  90. else
  91.   put "button" into objectType
  92. end if
  93.  
  94. --Is the object a card or background object?
  95. if the name of the target contains "bkgnd" then
  96.   put "bkgnd" into objectClass
  97. else
  98.   put "card" into objectClass
  99. end if
  100.  
  101. --What is the object's current number?
  102. put the number of the target into fromThis
  103.  
  104. --What is the highest possible number of the object
  105. if objectType = "button" then
  106.   if the name of the target contains "bkgnd" then
  107.     put the number of last bg btn into theRange
  108.   else
  109.     put the number of last btn into theRange
  110.   end if
  111. else
  112.   if objectType = "field" then
  113.     if the name of the target contains "card" then
  114.       put the number of last cd field into theRange
  115.     else
  116.       put the number of last field into theRange
  117.     end if
  118.   end if
  119. end if
  120. --Now we know the object's possible range.
  121.  
  122. --This is the function part of the function.  It returns
  123. --the target number of the object.
  124.  
  125. --Prompt the user for a target object number
  126. --& give the valid range of numbers.
  127. ask "Set " &objectClass &&objectType &&fromThis && "to what number? (1-" &theRange &")"
  128. if it is empty then exit to HyperCard
  129. set cursor to 4
  130. put it into objectNumber
  131.  
  132. --If user holds down option key while invoking "setLayer"
  133. --then the following error checking is bypassed.
  134. if optionState is up then
  135.  
  136.   --Error checking...make sure the user enters a valid number.
  137.   if objectNumber > theRange or objectNumber < 1 then
  138.     beep
  139.     answer "Sorry!  ‚Äú" &objectNumber &"‚Äù is not a valid " &objectType &&"number."
  140.     exit to HyperCard
  141.   else
  142.   end if
  143. end if
  144.  
  145. --Now we have the target number and information we need to proceed.
  146. return objectNumber - fromThis
  147. end objectInfo
  148.  
  149. --end ChangeObjectLayer 1.0
  150.  
  151. ------------------------------------------------------------------------
  152.  
  153. --YOU NEED ALL THE ABOVE SCRIPTS FOR "CHANGEOBJECTLAYER" TO WORK!!!
  154.  
  155.  
  156. -- part 13 (button)
  157. -- low flags: 00
  158. -- high flags: 8004
  159. -- rect: left=24 top=215 right=231 bottom=241
  160. -- title width / last selected line: 0
  161. -- icon id / first selected line: 0 / 0
  162. -- text alignment: 1
  163. -- font id: 0
  164. -- text size: 12
  165. -- style flags: 0
  166. -- line height: 16
  167. -- part name: Background Button 1
  168. ----- HyperTalk script -----
  169. on mouseUp
  170.   setlayer
  171.   lock screen
  172.   repeat with i = 1 to 6
  173.     set the name of bg btn i to "Background Button " & i
  174.   end repeat
  175.   unlock screen
  176. end mouseUp
  177.  
  178.  
  179.  
  180. -- part 14 (button)
  181. -- low flags: 00
  182. -- high flags: 8004
  183. -- rect: left=30 top=228 right=244 bottom=235
  184. -- title width / last selected line: 0
  185. -- icon id / first selected line: 0 / 0
  186. -- text alignment: 1
  187. -- font id: 0
  188. -- text size: 12
  189. -- style flags: 0
  190. -- line height: 16
  191. -- part name: Background Button 2
  192. ----- HyperTalk script -----
  193. on mouseUp
  194.   setlayer
  195.   lock screen
  196.   repeat with i = 1 to 6
  197.     set the name of bg btn i to "Background Button " & i
  198.   end repeat
  199.   unlock screen
  200. end mouseUp
  201.  
  202.  
  203.  
  204. -- part 15 (button)
  205. -- low flags: 00
  206. -- high flags: 8004
  207. -- rect: left=36 top=241 right=257 bottom=229
  208. -- title width / last selected line: 0
  209. -- icon id / first selected line: 0 / 0
  210. -- text alignment: 1
  211. -- font id: 0
  212. -- text size: 12
  213. -- style flags: 0
  214. -- line height: 16
  215. -- part name: Background Button 3
  216. ----- HyperTalk script -----
  217. on mouseUp
  218.   setlayer
  219.   lock screen
  220.   repeat with i = 1 to 6
  221.     set the name of bg btn i to "Background Button " & i
  222.   end repeat
  223.   unlock screen
  224. end mouseUp
  225.  
  226.  
  227.  
  228. -- part 16 (button)
  229. -- low flags: 00
  230. -- high flags: 8004
  231. -- rect: left=43 top=254 right=270 bottom=222
  232. -- title width / last selected line: 0
  233. -- icon id / first selected line: 0 / 0
  234. -- text alignment: 1
  235. -- font id: 0
  236. -- text size: 12
  237. -- style flags: 0
  238. -- line height: 16
  239. -- part name: Background Button 4
  240. ----- HyperTalk script -----
  241. on mouseUp
  242.   setlayer
  243.   lock screen
  244.   repeat with i = 1 to 6
  245.     set the name of bg btn i to "Background Button " & i
  246.   end repeat
  247.   unlock screen
  248. end mouseUp
  249.  
  250.  
  251.  
  252. -- part 1 (button)
  253. -- low flags: 00
  254. -- high flags: 8004
  255. -- rect: left=18 top=213 right=330 bottom=248
  256. -- title width / last selected line: 0
  257. -- icon id / first selected line: 27056 / 27056
  258. -- text alignment: 1
  259. -- font id: 0
  260. -- text size: 12
  261. -- style flags: 0
  262. -- line height: 16
  263. -- part name: Background Button 5
  264. ----- HyperTalk script -----
  265. on mouseUp
  266.   setlayer
  267.   lock screen
  268.   repeat with i = 1 to 6
  269.     set the name of bg btn i to "Background Button " & i
  270.   end repeat
  271.   unlock screen
  272. end mouseUp
  273.  
  274.  
  275.  
  276. -- part 18 (field)
  277. -- low flags: 01
  278. -- high flags: 0004
  279. -- rect: left=263 top=224 right=322 bottom=473
  280. -- title width / last selected line: 0
  281. -- icon id / first selected line: 0 / 0
  282. -- text alignment: 0
  283. -- font id: 4
  284. -- text size: 9
  285. -- style flags: 0
  286. -- line height: 12
  287. -- part name: 
  288. ----- HyperTalk script -----
  289. on mouseUp
  290.   setLayer
  291.   repeat with i = 1 to 6
  292.     put "Background Field " &the number of bg fld i into line 1 of bg field i
  293.   end repeat
  294. end mouseUp
  295.  
  296.  
  297.  
  298. -- part 21 (field)
  299. -- low flags: 01
  300. -- high flags: 0004
  301. -- rect: left=273 top=235 right=313 bottom=462
  302. -- title width / last selected line: 0
  303. -- icon id / first selected line: 0 / 0
  304. -- text alignment: 0
  305. -- font id: 4
  306. -- text size: 9
  307. -- style flags: 0
  308. -- line height: 12
  309. -- part name: 
  310. ----- HyperTalk script -----
  311. on mouseUp
  312.   setLayer
  313.   repeat with i = 1 to 6
  314.     put "Background Field " &the number of bg fld i into line 1 of bg field i
  315.   end repeat
  316. end mouseUp
  317.  
  318.  
  319.  
  320. -- part 22 (field)
  321. -- low flags: 01
  322. -- high flags: 0004
  323. -- rect: left=283 top=246 right=304 bottom=452
  324. -- title width / last selected line: 0
  325. -- icon id / first selected line: 0 / 0
  326. -- text alignment: 0
  327. -- font id: 4
  328. -- text size: 9
  329. -- style flags: 0
  330. -- line height: 12
  331. -- part name: 
  332. ----- HyperTalk script -----
  333. on mouseUp
  334.   setLayer
  335.   repeat with i = 1 to 6
  336.     put "Background Field " &the number of bg fld i into line 1 of bg field i
  337.   end repeat
  338. end mouseUp
  339.  
  340.  
  341.  
  342. -- part 23 (field)
  343. -- low flags: 01
  344. -- high flags: 0004
  345. -- rect: left=293 top=257 right=295 bottom=442
  346. -- title width / last selected line: 0
  347. -- icon id / first selected line: 0 / 0
  348. -- text alignment: 0
  349. -- font id: 4
  350. -- text size: 9
  351. -- style flags: 0
  352. -- line height: 12
  353. -- part name: 
  354. ----- HyperTalk script -----
  355. on mouseUp
  356.   setLayer
  357.   repeat with i = 1 to 6
  358.     put "Background Field " &the number of bg fld i into line 1 of bg field i
  359.   end repeat
  360. end mouseUp
  361.  
  362.  
  363.  
  364. -- part 24 (field)
  365. -- low flags: 01
  366. -- high flags: 0004
  367. -- rect: left=303 top=268 right=286 bottom=432
  368. -- title width / last selected line: 0
  369. -- icon id / first selected line: 0 / 0
  370. -- text alignment: 0
  371. -- font id: 4
  372. -- text size: 9
  373. -- style flags: 0
  374. -- line height: 12
  375. -- part name: 
  376. ----- HyperTalk script -----
  377. on mouseUp
  378.   setLayer
  379.   repeat with i = 1 to 6
  380.     put "Background Field " &the number of bg fld i into line 1 of bg field i
  381.   end repeat
  382. end mouseUp
  383.  
  384.  
  385.  
  386. -- part 7 (field)
  387. -- low flags: 01
  388. -- high flags: 4004
  389. -- rect: left=253 top=213 right=331 bottom=484
  390. -- title width / last selected line: 0
  391. -- icon id / first selected line: 0 / 0
  392. -- text alignment: 0
  393. -- font id: 4
  394. -- text size: 9
  395. -- style flags: 0
  396. -- line height: 12
  397. -- part name: 
  398. ----- HyperTalk script -----
  399. on mouseUp
  400.   setLayer
  401.   if the number of me = 6 then
  402.     put "Change me to Background Field 1!" into line 5 of me
  403.     set the showlines of me to true
  404.   else
  405.     put empty into line 5 of me
  406.     set the showlines of me to false
  407.   end if
  408.   repeat with i = 1 to 6
  409.     put "Background Field " &the number of bg fld i into line 1 of bg field i
  410.   end repeat
  411. end mouseUp
  412.  
  413.